package com.jiugang.cardump.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class TimeUtil {
    public static String dateRoll(Integer minute) {
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        //（1）获取当前时间
        LocalDateTime date = LocalDateTime.now();
        //（2）获取当前时间的前几小时时间
        LocalDateTime localDateTime = date.minusMinutes(minute);
        return dateTimeFormatter.format(localDateTime);
    }
}
